import valueSetAPI from "@api/valueSetAPI.js";
export function getValueSetsByConfig(configs) {
  let asyncArr = [];
  for (let item of configs) {
    asyncArr.push(
      valueSetAPI.getValueSetByCode(item.code).then(data => {
        item.targetObj[item.attr] = data;
      })
    );
  }

  return Promise.all(asyncArr);
}

export function debounce(fn, wait) {
  let timer;
  return function () {
    console.log(timer);
    clearTimeout(timer);
    timer = setTimeout(fn, wait);
  };
}
